package com.guomao.demob;

import java.util.function.Supplier;

public class JavaDemo1 {

    public static void main(String[] args) {

        /*String s1 = method1(new Supplier<String>() {
            @Override
            public String get() {
                return "福建厦门";
            }
        });*/

        String s1 = method1(() -> "Hello");

        /*Integer i = method2(new Supplier<Integer>() {
            @Override
            public Integer get() {
                return 100;
            }
        });*/

        Integer i = method2(() -> 100);

        int[] arr = {1, 2, 3, 0, 10, 50, 6};


        Integer result = method3(() -> {
            int max = arr[0];
            for (int j = 1; j < arr.length; j++) {
                if (max < arr[j]) {
                    max = arr[j];
                }
            }
            return max;
        });

        System.out.println(result);
    }

    public static String method1(Supplier<String> s) {
        return s.get();
    }


    public static Integer method2(Supplier<Integer> s) {
        return s.get();
    }

    public static Integer method3(Supplier<Integer> s) {
        return s.get();
    }
}
